﻿using System;

class Conversion
{
    static void Main()
    {
        //Exercise 11.
        //* Write a program that converts a number in the range [0...999] to a text corresponding to its English pronunciation. 
        //Examples:
        //0 -> "Zero"
        //273 -> "Two hundred seventy three"
        //400 -> "Four hundred"
        //501 -> "Five hundred and one"
        //711 -> "Seven hundred and eleven"

        Console.Write("Enter a number in the range [0...999]:  ");
        int number = int.Parse(Console.ReadLine());
        int hundreds = number / 100;        
        int tens = (number % 100) / 10;        
        int teens = number % 100;        
        int lastdigit = (number % 100) % 10;        
        Console.WriteLine();

        if (hundreds >= 1)
        {
            switch (hundreds)
            {
                case 1:
                    Console.Write("One hundred ");
                    break;
                case 2:
                    Console.Write("Two hundred ");
                    break;
                case 3:
                    Console.Write("Three hundred ");
                    break;
                case 4:
                    Console.Write("Four hundred ");
                    break;
                case 5:
                    Console.Write("Five hundred ");
                    break;
                case 6:
                    Console.Write("Six hundred ");
                    break;
                case 7:
                    Console.Write("Seven hundred ");
                    break;
                case 8:
                    Console.Write("Eight hundred ");
                    break;
                case 9:
                    Console.Write("Nine hundred ");
                    break;               
                default:
                    break;
            }
        }
        

        if (tens > 1)
        {
            switch (tens)
            {
                case 2:
                    Console.Write("twenty ");
                    break;
                case 3:
                    Console.Write("thirty ");
                    break;
                case 4:
                    Console.Write("fourty ");
                    break;
                case 5:
                    Console.Write("fifty ");
                    break;
                case 6:
                    Console.Write("sixty ");
                    break;
                case 7:
                    Console.Write("seventy ");
                    break;
                case 8:
                    Console.Write("eighty ");
                    break;
                case 9:
                    Console.Write("ninty ");
                    break;
                    default:
                    break;
            }
        }
        

        if ((tens == 1) && (teens >= 10) && (teens < 20))
        {
            switch (teens)
            {
                case 10:
                    Console.WriteLine("ten ");
                    break;
                case 11:
                    Console.WriteLine("eleven ");
                    break;
                case 12:
                    Console.WriteLine("twelve ");
                    break;
                case 13:
                    Console.WriteLine("thirteen ");
                    break;
                case 14:
                    Console.WriteLine("fourteen ");
                    break;
                case 15:
                    Console.WriteLine("fifteen ");
                    break;
                case 16:
                    Console.WriteLine("sixteen ");
                    break;
                case 17:
                    Console.WriteLine("seventeen ");
                    break;
                case 18:
                    Console.WriteLine("eighteen ");
                    break;
                case 19:
                    Console.WriteLine("nineteen ");
                    break;
                default:
                    break;
            }
        }

        else if (lastdigit > 0)
        {
            switch (lastdigit)
            {
               case 1:
                    Console.WriteLine("one");
                    break;
                case 2:
                    Console.WriteLine("two");
                    break;
                case 3:
                    Console.WriteLine("three");
                    break;
                case 4:
                    Console.WriteLine("four");
                    break;
                case 5:
                    Console.WriteLine("five");
                    break;
                case 6:
                    Console.WriteLine("six");
                    break;
                case 7:
                    Console.WriteLine("seven");
                    break;
                case 8:
                    Console.WriteLine("eight");
                    break;
                case 9:
                    Console.WriteLine("nine");
                    break;

                default:
                    break;
            }
        }
        
        if (number == 0)
        {
            Console.WriteLine("Zero");
        }

        Console.WriteLine();
    }
}

